<template>
  <view class="sign-coverView">
    <view :class="[horizontal ? 'horizontalView' : 'verticalView']">
      <SignPage style="width: 100%; height: 100%;" ref="signRef" @onChangeHorizontal="onChangeHorizontal"
        @onCancle="onCancle" @ongetSignData="ongetSignData" :horizontal="horizontal" />
    </view>
  </view>
</template>
<script>

import SignPage from "@/improve/components/common/SignPage.vue";
import { notificationFun } from "../../../utils/PrjUtils";

export default {
  name: "SignPopup",
  components: { SignPage },
  data() {
    return {
      horizontal: true, // 是否横屏
      isFinishSign: false, // 是否签字完成
    }
  },
  methods: {
    onCancle() {
      this.$emit("close");
    },
    onChangeHorizontal(data) {
      this.horizontal = data;
    },
    ongetSignData(data) {
      this.onSendSign(data)
    },
    onSendSign(signData) {
      if (signData) {
        this.$emit('success', signData)
      } else {
        return notificationFun('请先完成签名')
      }
    },
  }
}
</script>
<style scoped lang="scss">
.sign-coverView {
  height: 100vh;
  width: 100vw;
  background: #00000080;
  position: fixed;
  z-index: 1000000;
  left: 0;
  top: 0;

  .horizontalView {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    bottom: 30rpx;
    width: 90%;
    border-radius: 40rpx;
    height: 90%;
    background: #FFFFFF;
  }

  .verticalView {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    bottom: 30rpx;
    width: 90%;
    border-radius: 40rpx;
    height: 640rpx;
    background: #FFFFFF;
  }
}
</style>